<template>
	<view>
		<!-- <web-view style="width: 750upx;height: auto;" :src="link"></web-view> -->
		<rich-text :nodes="agreement"></rich-text>
	</view>
</template>

<script>
	import urlConfig from 'common/config.js';
	export default {
		data() {
			return {
				link:'',
				agreement:''
			}
		},
		onLoad(link) {
			this.link = link.link
			this.type_api()
		},
		methods: {
			type_api() {
				var that = this
				uni.request({
					url: urlConfig.Url + 'api/index/banners',
					data:{
						access_token:uni.getStorageSync('access_token'),
						id:that.link
					},
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: (res) => {
						if (res.data.code == 0) {
							console.log('res.data.data',res.data.data)
							var richtext=  res.data.data
							const regex = new RegExp('<img', 'gi');
							richtext= richtext.replace(regex, `<img style="max-width: 100%;"`);
							var fullContent = richtext.replace(/&nbsp;/g, '\xa0');
							this.agreement = fullContent
							that.video = res.data.data.video
						} else if (res.data.code == -1) {	
							uni.reLaunch({
								url:'../disembark/disembark'
							})
						} else {
							uni.showToast({
								title: res.data.msg,
								duration: 2000,
								icon: 'none'
							});
						}
					}
				});
			},
		}
	}
</script>

<style>

</style>
